<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta charset="UTF-8">
		<title>人工调度</title>
		<!-- 导入jquery核心类库 -->
		<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.8.3.js"></script>
		<!-- 导入easyui类库 -->
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/js/easyui/themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/js/easyui/themes/icon.css">
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/js/easyui/ext/portal.css">
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/default.css">
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/city-picker.css">
		<script type="text/javascript" src="${pageContext.request.contextPath}/js/easyui/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/js/easyui/ext/jquery.portal.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/js/easyui/ext/jquery.cookie.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/js/citypicker/city-picker.data.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/js/citypicker/city-picker.js"></script>
		<script src="${pageContext.request.contextPath}/js/easyui/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
		<script type="text/javascript">
			$(function() {
				var rows=undefined;
				$("#grid").datagrid({
					singleSelect : true,
					pageList: [20,50,100],
					pagination : true,
					url: "${pageContext.request.contextPath}/orderAction_pageQuery.action",
					onDblClickRow :function(rowIndex,rowData){
							//将数据回显表单中 -调用表单方法  load   加载记录填充表格
							rows=rowData;
							console.info(rowData.sendArea);
							$("#dispatcherForm").form("load",rowData);
					},
					toolbar : [ {
						id : 'dispatcher',
						text : '人工调度',						
						iconCls : 'icon-edit',
						handler : function() {
							var arr=$("#grid").datagrid("getSelections");
							if(arr.length==0){
								$.messager.alert("系统信息","请选择一条记录","warning");
							}
							$("#courierId").combobox({
								url:"${pageContext.request.contextPath}/courierAction_findCourierByFixedId.action?areaString="+rows.areaString,
								valueField:'id',    
							    textField:'name'   		
							});
							// 弹出窗口
							$("#dispatcherWindow").window('open');
						}
					} ],
					columns : [ [ {
						field : 'id',
						title : '编号',
						width : 30
					},{
						field : 'orderNum',
						title : '订单号',
						width : 250
					}, {
						field : 'sendName',
						title : '联系人',
						width : 100
					}, {
						field : 'sendMobile',
						title : '电话',
						width : 100
					}, {
						field : 'sendAddress',
						title : '取件地址',
						width : 250
					}, {
						field : 'goodsType',
						title : '货物',
						width : 100
					}, {
						field : 'stringTime',
						title : '下单时间',
						width : 150
						 /*  formatter : function(data, row, index) {
							return data.year;
						}   */
					} ] ],
				});
		
				// 点击保存按钮，为通知单 进行分单 --- 生成工单
				$("#save").click(function() {
					var flag=$("#dispatcherForm").form("validate");
					if(flag){
						$("#orderId").val(rows.id);
						$("#dispatcherForm").submit();
					}
				});
			});
		</script>
	</head>

	<body class="easyui-layout">
		<div data-options="region:'center',border:false">
			<table id="grid"></table>
		</div>
		<div class="easyui-window" title="人工调度" id="dispatcherWindow" closed="true" collapsible="false" minimizable="false" maximizable="false" style="top:100px;left:200px;width: 600px; height: 500px">
			<div region="north" style="height:30px;overflow:hidden;" split="false" border="false">
				<div class="datagrid-toolbar">
					<a id="save" icon="icon-save" href="#" class="easyui-linkbutton" plain="true" onclick=>保存</a>
					<script type="text/javascript">
					</script>
				</div>
			</div>
			<div region="center" style="overflow:auto;padding:5px;width: 550px; height: 400px" border="false">
				<form id="dispatcherForm" method="post" action="${pageContext.request.contextPath}/orderAction_update.action">
					<table class="table-edit" width="80%"  align="center">
						<tr class="title">
							<td colspan="2">人工调度</td>
						</tr>
						<tr>
							<td>订单编号</td>
							<td>
								<input type="hidden" name="id" id="orderId" /> <span id="orderIdView"></span>
						</tr>
						<tr>
							<td>客户电话</td>
							<td>
								<input type="text" name="sendMobile" id="sendMobile" /> <span id="orderIdView"></span>
						</tr>
						<tr>
							<td>省市区</td>
							<td>
							<div style="position: relative;">
								<!-- container -->
								<input readonly type="text" data-toggle="city-picker" name="pickerName">
							</div></tr>
						<tr>
							<td>客户地址</td>
							<td>
								<input type="text" name="sendAddress" id="sendAddress" /> <span id="orderIdView"></span>
						</tr>
						<tr>
							<td>选择快递员</td>
							<td>
								<input type="text" name="courierId" id="courierId">
								<!--  <input class="easyui-combobox" required="true" name="courier.id" data-options="valueField:'id',textField:'name',url:'courierAction_findCourierByFixedId.action?province="+rows.sendArea.city+"' /> -->  
							</td>
						</tr>
					</table>
				</form>
			</div>
		</div>
	</body>
</html>